<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="htmlId">
<head>
    <title>Coverage Report :: StartupSystemTest</title>
    <style type="text/css">
        @import "../../.css/coverage.css";
    </style>
</head>

<body>
<div class="header"></div>

<div class="content">
    <div class="breadCrumbs">
        [ <a href="../../index.html">all classes</a> ]
        [ <a href="../index.html">nl.tudelft.jpacman.integration</a> ]
    </div>

    <h1>Coverage Summary for Class: StartupSystemTest (nl.tudelft.jpacman.integration)</h1>

    <table class="coverageStats">
        <tr>
            <th class="name">Class</th>
            <th class="coverageStat
">
                Class, %
            </th>
            <th class="coverageStat
">
                Method, %
            </th>
            <th class="coverageStat
">
                Line, %
            </th>
        </tr>
        <tr>
            <td class="name">StartupSystemTest</td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 1)
  </span>
            </td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 6)
  </span>
            </td>
            <td class="coverageStat">
  <span class="percent">
    0%
  </span>
                <span class="absValue">
    (0/ 16)
  </span>
            </td>
        </tr>

    </table>

    <br/>
    <br/>


    <div class="sourceCode"><i>1</i>&nbsp;package nl.tudelft.jpacman.integration;
        <i>2</i>&nbsp;
        <i>3</i>&nbsp;import nl.tudelft.jpacman.Launcher;
        <i>4</i>&nbsp;import nl.tudelft.jpacman.game.Game;
        <i>5</i>&nbsp;import nl.tudelft.jpacman.level.Player;
        <i>6</i>&nbsp;
        <i>7</i>&nbsp;import org.junit.jupiter.api.AfterEach;
        <i>8</i>&nbsp;import org.junit.jupiter.api.BeforeEach;
        <i>9</i>&nbsp;import org.junit.jupiter.api.MethodOrderer;
        <i>10</i>&nbsp;import org.junit.jupiter.api.Order;
        <i>11</i>&nbsp;import org.junit.jupiter.api.Test;
        <i>12</i>&nbsp;import org.junit.jupiter.api.TestMethodOrder;
        <i>13</i>&nbsp;
        <i>14</i>&nbsp;import static org.assertj.core.api.Assertions.assertThat;
        <i>15</i>&nbsp;
        <i>16</i>&nbsp;import java.util.List;
        <i>17</i>&nbsp;
        <i>18</i>&nbsp;/**
        <i>19</i>&nbsp; * An example test class that conducts integration tests.
        <i>20</i>&nbsp; */
        <i>21</i>&nbsp;@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
        <b class="nc"><i>22</i>&nbsp;public class StartupSystemTest {</b>
        <i>23</i>&nbsp;
        <i>24</i>&nbsp; private Launcher launcher;
        <i>25</i>&nbsp;
        <i>26</i>&nbsp; /**
        <i>27</i>&nbsp; * Start a launcher, which can display the user interface.
        <i>28</i>&nbsp; */
        <i>29</i>&nbsp; @BeforeEach
        <i>30</i>&nbsp; public void before() {
        <b class="nc"><i>31</i>&nbsp; launcher = new Launcher();</b>
        <i>32</i>&nbsp; }
        <i>33</i>&nbsp;
        <i>34</i>&nbsp; /**
        <i>35</i>&nbsp; * Close the user interface.
        <i>36</i>&nbsp; */
        <i>37</i>&nbsp; @AfterEach
        <i>38</i>&nbsp; public void after() {
        <b class="nc"><i>39</i>&nbsp; launcher.dispose();</b>
        <i>40</i>&nbsp; }
        <i>41</i>&nbsp;
        <i>42</i>&nbsp; /**
        <i>43</i>&nbsp; * The simplest test that just starts the
        <i>44</i>&nbsp; * game and checks it is indeed in progress.
        <i>45</i>&nbsp; * @throws InterruptedException
        <i>46</i>&nbsp; */
        <i>47</i>&nbsp; @Test
        <i>48</i>&nbsp; @Order(1)
        <i>49</i>&nbsp; public void gameIsRunning() throws InterruptedException {
        <b class="nc"><i>50</i>&nbsp; launcher.launch();</b>
        <i>51</i>&nbsp;
        <b class="nc"><i>52</i>&nbsp; getGame().start();</b>
        <i>53</i>&nbsp;
        <b class="nc"><i>54</i>&nbsp; Thread.sleep(5000L);</b>
        <i>55</i>&nbsp;
        <i>56</i>&nbsp; //游戏启动
        <i>57</i>&nbsp;// assertThat(getGame().isInProgress()).isTrue();
        <i>58</i>&nbsp;
        <i>59</i>&nbsp; // Players
        <b class="nc"><i>60</i>&nbsp; List&lt;Player&gt; players = getGame().getPlayers();</b>
        <b class="nc"><i>61</i>&nbsp; assertThat(players.size()).isEqualTo(1);</b>
        <b class="nc"><i>62</i>&nbsp; assertThat(players.get(0).getScore()).isEqualTo(0);</b>
        <i>63</i>&nbsp;
        <i>64</i>&nbsp; }
        <i>65</i>&nbsp;
        <i>66</i>&nbsp; @Test
        <i>67</i>&nbsp; @Order(2)
        <i>68</i>&nbsp; public void gameIsPending() throws InterruptedException {
        <b class="nc"><i>69</i>&nbsp; launcher.launch();</b>
        <b class="nc"><i>70</i>&nbsp; getGame().start();</b>
        <i>71</i>&nbsp;
        <b class="nc"><i>72</i>&nbsp; Thread.sleep(5000);</b>
        <i>73</i>&nbsp;
        <i>74</i>&nbsp; //游戏启动
        <i>75</i>&nbsp;// assertThat(getGame().isInProgress()).isTrue();
        <i>76</i>&nbsp;
        <i>77</i>&nbsp; //暂停
        <b class="nc"><i>78</i>&nbsp; getGame().stop();</b>
        <b class="nc"><i>79</i>&nbsp; Thread.sleep(5000);</b>
        <i>80</i>&nbsp;
        <b class="nc"><i>81</i>&nbsp; assertThat(getGame().isInProgress()).isFalse();</b>
        <i>82</i>&nbsp;
        <i>83</i>&nbsp; }
        <i>84</i>&nbsp;
        <i>85</i>&nbsp; private Game getGame() {
        <b class="nc"><i>86</i>&nbsp; return launcher.getGame();</b>
        <i>87</i>&nbsp; }
        <i>88</i>&nbsp;}
    </div>
</div>

<div class="footer">

    <div style="float:right;">generated on 2023-04-25 16:45</div>
</div>
</body>
</html>
